#ifndef DICTIONARY_GRAMMAR_H
#define DICTIONARY_GRAMMAR_H

#include <string>
#include <cstring>
#include <cstdlib>

namespace Dictionary
{
	class Grammar
	{
		public :
			static Grammar DOCUMENT() { return Grammar("document"); }
			static Grammar FILENAME() { return Grammar("file-name"); }
			static Grammar TOTALTERMCOUNT() { return Grammar("total-term-count"); }
			static Grammar UNIQUETERMCOUNT() { return Grammar("unique-term-count"); }
			static Grammar TOTALSENTENCECOUNT() { return Grammar("total-sentence-count"); }
			static Grammar NODE() { return Grammar("node"); }
			static Grammar ID() { return Grammar("id"); }
			static Grammar TERM() { return Grammar("term"); }
			static Grammar TOTALTERMFREQUENCY() { return Grammar("total-term-frequency"); }
			static Grammar SECTION() { return Grammar("section"); }
			static Grammar TERMFREQUENCY() { return Grammar("term-frequency"); }
			static Grammar SENTENCE() { return Grammar("sentence"); }
			static Grammar NUMBER() { return Grammar("number"); }
			static Grammar PLACE() { return Grammar("place"); }
			static Grammar CONNECTINGWORD() { return Grammar("connecting-word"); }
			static Grammar NEXTID() { return Grammar("next-id"); }

			static Grammar TITLETYPE() { return Grammar("title"); }
			static Grammar LINKTYPE() { return Grammar("link"); }
			static Grammar TEXTTYPE() { return Grammar("text"); }
			static Grammar METAKEYWORDTYPE() { return Grammar("meta-keyword"); }
			static Grammar METADESCRIPTIONTYPE() { return Grammar("meta-description"); }
			static Grammar CAPTIONTYPE() { return Grammar("caption"); }
			static Grammar HEADINGTYPE() { return Grammar("heading"); }

			static Grammar FILE() { return Grammar("file"); }

			enum State { document, node, section, sentence , none};

			bool operator==(char *) const;
			bool operator==(const std::string &) const;

			~Grammar() { std::free(element); }
		private:
			explicit Grammar(char* elem) 
			{
				element = (char *)std::malloc((std::strlen(elem) + 1)*sizeof(char));
				std::strcpy(element,elem);
			}
			Grammar(const Grammar &);

			char *element;
	};
}
#endif